package com.xitang.common.controller;

import com.xitang.common.dto.BasicException;
import com.xitang.common.dto.ResultVO;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExHandler {
    @ExceptionHandler(Exception.class)
    public ResultVO<String> handleEx(Exception e){
        e.printStackTrace();
        if (e instanceof BasicException) {
            return ResultVO.error(e.getMessage());
        }
        return ResultVO.error("出异常了，请与运维联系！");
    }
}